//
//  MainViewController.m
//  YMDemo
//
//  Created by admin on 2022/2/25.
//

#import "MainViewController.h"
#import <YMLiveKit/YMLiveKit.h>

@interface MainViewController()

@end

@implementation MainViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    self.navigationController.navigationBar.hidden = YES;
    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        
        self.navigationController.interactivePopGestureRecognizer.enabled = NO;
    }
    
    self.view.backgroundColor = [UIColor whiteColor];
    YMLivePreview *livePreview = [[YMLivePreview alloc] initWithFrame:[UIScreen mainScreen].bounds];
    livePreview.liveUrl = self.liveUrl;
    [self.view addSubview:livePreview];
    __weak typeof(livePreview) weakView = livePreview;
    [livePreview setNavPopBlock:^{
       
        [weakView refreshLiveView];
//       [self.navigationController popToRootViewControllerAnimated:YES];
 
    }];

}

-(void)viewWillDisappear:(BOOL)animated{
    
    [super viewWillDisappear:animated];
    self.navigationController.navigationBar.hidden = NO;
    self.navigationController.interactivePopGestureRecognizer.enabled = YES;
}

@end

